package com.legal.exception;

import com.legal.enums.CommonExceptionEnums;
import lombok.Getter;

/**
 *
 */
@Getter
public class CommonException extends RuntimeException{
    private int code;

    public CommonException(String message, int code) {
        super(message);
        this.code = code;
    }

    public CommonException(String message, Throwable cause, int code) {
        super(message, cause);
        this.code = code;
    }

    public CommonException(Throwable cause, int code) {
        super(cause);
        this.code = code;
    }

    /**
     * 根据枚举类构造异常
     * 构造函数
     * @param enums
     */
    public CommonException(CommonExceptionEnums enums){
        super(enums.getMsg());
        this.code = enums.getCode();
    }
}
